﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Common
{
    public static class TypeEx
    {
        public static object Create(string fullName)
        {
            if (String.IsNullOrEmpty(fullName)) throw new ArgumentNullException("fullName");

            try
            {
                System.Type LookupType = System.Type.GetType(fullName);

                return Activator.CreateInstance(LookupType);
            }
            catch (Exception ex)
            {
                
                throw ex;
            }
        }

        public static T Create<T>(string fullName)
        {
            if (String.IsNullOrEmpty(fullName)) throw new ArgumentNullException("fullName");

            try
            {
                System.Type LookupType = System.Type.GetType(fullName);

                return (T)Activator.CreateInstance(LookupType);
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
    }
}
